for (var t = new Date(), a = [], e = [], o = getApp(), s = 1990; s <= t.getFullYear(); s++) a.push(s);

for (var n = 1; n <= 12; n++) e.push(n);

Page({
    data: {
        years: a,
        year: t.getFullYear(),
        months: e,
        month: t.getMonth() + 1,
        value: [ 9999, 1, 1 ],
        show: !1,
        _num: 0,
        ss: "-00 00:00",
        text: "未完成",
        flag: !0
    },
    menuClick: function(t) {
        console.log(t), this.setData({
            _num: t.currentTarget.dataset.num
        }), 0 == this.data._num ? this.setData({
            text: "未完成"
        }) : 1 == this.data._num && this.setData({
            text: "已完成"
        }), this.onClick();
    },
    date: function(t) {
        this.setData({
            show: !0
        });
    },
    hide: function(t) {
        this.setData({
            show: !1
        });
    },
    bindChange: function(t) {
        var a = t.detail.value;
        console.log(t.detail.value), this.setData({
            year: this.data.years[a[0]],
            month: this.data.months[a[1]]
        }), this.onClick(), this.onClass1();
    },
    onLoad: function(t) {
        // var a = this;
        // a.onClass1(), a.onClick(), wx.getSystemInfo({
        //     success: function(t) {
        //         a.setData({
        //             height: t.windowHeight
        //         });
        //     }
        // });
        let that = this;
        that.setData({
          _num:0
        });
        let shuju = {
          unfinished:2,
          finished:1
        };
        that.setData({
          count:shuju
        });
      that.setData({
        text: '去哪里'
      });
        let shuju1 = {
          date:1,
          patientBase:{
            userIcon: '/assets/images/head.png',
            name:'小花'
          },
          price:200,
          doctorServiceNm:10
        };
      let shuju2 = [shuju1, shuju1, shuju1, shuju1]
        that.setData({
          arr: shuju2
        });
    },
    onClass1: function(t) {
        var a = this, e = a.data.year + "-" + a.data.month + a.data.ss, s = wx.getStorageSync("log") || "";
        wx.request({
            url: o.globalData.dic + "doctor/personal/workloadCount",
            data: {
                token: s,
                dateStr: e
            },
            success: function(t) {
                console.log(t.data.data), a.setData({
                    count: t.data.data
                });
            }
        });
    },
    onClick: function(t) {
        var a = this, e = a.data.year + "-" + a.data.month + a.data.ss, s = wx.getStorageSync("log") || "";
        wx.request({
            url: o.globalData.dic + "doctor/personal/workload",
            data: {
                token: s,
                dateStr: e,
                status: a.data._num,
                currentResult: 0
            },
            success: function(t) {
                console.log(t.data.data), a.setData({
                    nextResult: t.data.data.page.nextResult,
                    arr: t.data.data.orderS
                });
            }
        });
    },
    lower: function() {
        if (this.data.flag) {
            var t, a = this, e = this.data.nextResult, s = a.data.arr;
            console.log(e);
            var n = wx.getStorageSync("log") || "", l = a.data.year + "-" + a.data.month + a.data.ss;
            wx.request({
                url: o.globalData.dic + "doctor/personal/workload",
                data: {
                    token: n,
                    dateStr: l,
                    status: a.data._num,
                    currentResult: e
                },
                success: function(e) {
                    if (console.log(e), console.log(e.data.data.page.nextResult), 200 == e.data.code) {
                        a.setData({
                            nextResult: e.data.data.page.nextResult
                        }), console.log(a.data.nextResult);
                        var o = e.data.data.orderS;
                        if (t = s.concat(o), console.log(o.length), console.log(t), 10 != e.data.data.orderS.length) return wx.showToast({
                            title: "已到达底部",
                            icon: "success",
                            duration: 3e3
                        }), a.setData({
                            arr: t
                        }), a.setData({
                            flag: !1
                        }), !1;
                        wx.showLoading({
                            title: "加载中",
                            icon: "loading"
                        }), setTimeout(function() {
                            a.setData({
                                arr: t
                            }), wx.hideLoading();
                        }, 1500);
                    }
                }
            });
        }
    }
});